#include "ViewList.h"

ViewList::ViewList(HWND hWnd, const iSize& size)
: _hWnd(hWnd), _size(size)
{
}

ViewList::~ViewList(void)
{
}

void ViewList::onPaint( HDC hDC, ScanFile *pScanFile )
{
	int nb = pScanFile->getNbFile();
	RECT rect;
	::GetClientRect( _hWnd, &rect );
	int h = 50;
	for (int i=0; i<nb; i++)
	{
		File *pFile = pScanFile->getFile( i );
		::Rectangle( hDC, 100, i*h, rect.right, (i+1)*h );
		RECT rectText;
		::SetRect( &rectText, 150, i*h, rect.right, (i+1)*h );
		//std::wstring str = pFile->getName() + L" " + pFile->getTag("TITLE");
		std::wstring str =  pFile->getTag("ARTIST") + L" " + pFile->getTag("TITLE");
		::DrawText( hDC, str.c_str(), -1, &rectText, DT_SINGLELINE|DT_VCENTER );
	}
}